<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Database API Functions &mdash; Documentation</title>
    <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Documentation" href="index.html" />
    <link rel="up" title="3. Server Side API" href="server_side_api.html" />
    <link rel="next" title="doc — Document (ORM)" href="doc.html" />
    <link rel="prev" title="3. Server Side API" href="server_side_api.html" /> 
  </head>
  <body>
    <div style="background-color: #FFF; text-align: left; padding: 8px 0px"><img src="_static/banner300910.gif"></div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="doc.html" title="doc — Document (ORM)"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="server_side_api.html" title="3. Server Side API"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Documentation</a> &raquo;</li>
          <li><a href="server_side_api.html" accesskey="U">3. Server Side API</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h4>Previous topic</h4>
            <p class="topless"><a href="server_side_api.html"
                                  title="previous chapter">3. Server Side API</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="doc.html"
                                  title="next chapter"><tt class="docutils literal"><span class="pre">doc</span></tt> &#8212; Document (ORM)</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/database_api.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="database-api-functions">
<h1>Database API Functions<a class="headerlink" href="#database-api-functions" title="Permalink to this headline">¶</a></h1>
<p>Common Database functions. These are a part of the <a title="Database Module" class="reference external" href="db.html#module-db"><tt class="xref docutils literal"><span class="pre">db</span></tt></a> Module and reproduced here because these are
global and used in API</p>
<dl class="function">
<dt id="sql">
<tt class="descname">sql</tt><big>(</big><em>query</em>, <em>values=()</em>, <em>as_dict = 0</em>, <em>as_list = 0</em>, <em>allow_testing = 1</em><big>)</big><a class="headerlink" href="#sql" title="Permalink to this definition">¶</a></dt>
<dd><ul class="simple">
<li>Execute a <cite>query</cite>, with given <cite>values</cite></li>
<li>returns as a dictionary if as_dict = 1</li>
<li>returns as a list of lists (with cleaned up dates and decimals) if as_list = 1</li>
</ul>
</dd></dl>

<dl class="function">
<dt id="convert_to_lists">
<tt class="descname">convert_to_lists</tt><big>(</big><em>res</em><big>)</big><a class="headerlink" href="#convert_to_lists" title="Permalink to this definition">¶</a></dt>
<dd>Convert the given result set to a list of lists (with cleaned up dates and decimals)</dd></dl>

<dl class="function">
<dt id="get_value">
<tt class="descname">get_value</tt><big>(</big><em>dt</em>, <em>dn</em>, <em>fieldname</em><big>)</big><a class="headerlink" href="#get_value" title="Permalink to this definition">¶</a></dt>
<dd>Return the value of the given field in the given record. For Single Type, set dn = None</dd></dl>

<dl class="function">
<dt id="set">
<tt class="descname">set</tt><big>(</big><em>doc</em>, <em>field</em>, <em>val</em><big>)</big><a class="headerlink" href="#set" title="Permalink to this definition">¶</a></dt>
<dd>Set a field value in the <a title="doc.Document" class="reference external" href="doc.html#doc.Document"><tt class="xref docutils literal"><span class="pre">doc.Document</span></tt></a> and upate it in the Database.</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="doc.html" title="doc — Document (ORM)"
             >next</a> |</li>
        <li class="right" >
          <a href="server_side_api.html" title="3. Server Side API"
             >previous</a> |</li>
        <li><a href="index.html">Documentation</a> &raquo;</li>
          <li><a href="server_side_api.html" >3. Server Side API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2010, Rushabh Mehta.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
    </div>
  </body>
</html>